<template>
	<div class="detailView">
		<div class="bottomView">
			<el-button type="primary" @click="back">返回</el-button>
			<div class="detail">
				<h4>用户名:</h4>
				<span>{{ userName }}</span>
			</div>
			<div class="detail">
				<h4>电话:</h4>
				<span>{{ userPhone }}</span>
			</div>
			<div class="detail">
				<h4>地址:</h4>
				<span>{{ address }}</span>
			</div>
		</div>

	</div>
</template>

<script>
export default {
	data() {
		return {
			baseUrl: require("../assets/baseUrl.js").baseUrl,
			outletId:0,
			userId:0,
			userName:"",
			userPhone:"",
			address:""
		}
	},
	methods: {
		back() {
			if(this.outletId!=undefined){
					this.$router.push('/staticsproject/statistics?outletId='+this.outletId)
			}else{
				this.$router.push('/saleproject/saleaaView')
			}
	
		},
		//根据id查询信息
		finduser(){
			// http://localhost:8081/user/find
			this.$http.post(this.baseUrl+"user/find",{
				userId:this.userId
			}).then(res=>{
				this.userName=res.data.data.userName
				this.userPhone=res.data.data.userPhone
				let addlist=res.data.data.address
				addlist.forEach(v => {
					// console.log(v)
					if(v.isDefault==1){
						this.address=v.addressContent
					}
				});
			})
		}

	},
	mounted() {
		this.outletId=this.$route.query.outletId
		this.userId=this.$route.query.userId
		this.finduser()
	}
}
</script>

<style lang="less">
.detailView {
	display: flex;
	flex-direction: column;

	.bottomView {
		display: flex;
		flex-direction: column;
		width: 80vw;
		margin-left: 30px;

		.el-button {
			width: 80px;
			height: 40px;
			margin-bottom: 20px;
			font-size: 20px;
			border-radius: 10px;
			line-height: 15px;
		}

		.detail {
			display: flex;
			line-height: 45px;

			h4 {
				font-size: 24px;
				width: 100px;
				text-align: left;
			}

			span {
				font-size: 20px;
				color: #999;
			}
		}
	}

}
</style>